Serialize.SerialBuffer
EOSIO Javascript / Exports / Serialize / SerialBuffer
Class: SerialBuffer
Serialize.SerialBuffer
Serialize and deserialize data
Table of contents
Constructors
Properties
Methods
- asUint8Array
- get
- getAsset
- getBytes
- getFloat32
- getFloat64
- getName
- getPrivateKey
- getPublicKey
- getSignature
- getString
- getSymbol
- getSymbolCode
- getUint16
- getUint32
- getUint64AsNumber
- getUint8Array
- getVarint32
- getVaruint32
- haveReadData
- push
- pushArray
- pushAsset
- pushBytes
- pushFloat32
- pushFloat64
- pushName
- pushNumberAsUint64
- pushPrivateKey
- pushPublicKey
- pushSignature
- pushString
- pushSymbol
- pushSymbolCode
- pushUint16
- pushUint32
- pushUint8ArrayChecked
- pushVarint32
- pushVaruint32
- reserve
- restartRead
- skip
Constructors
constructor
• new SerialBuffer(__namedParameters?
)
Parameters
Name | Type | Description |
---|---|---|
__namedParameters | Object | array : null if serializing, or binary data to deserialize textEncoder : TextEncoder instance to use. Pass in null if running in a browser * textDecoder : TextDecider instance to use. Pass in null if running in a browser |
__namedParameters.array? | Uint8Array | - |
__namedParameters.textDecoder? | TextDecoder | - |
__namedParameters.textEncoder? | TextEncoder | - |
Defined in
src/eosjs-serialize.ts:126
Properties
array
• array: Uint8Array
Data in serialized (binary) form
Defined in
src/eosjs-serialize.ts:112
length
• length: number
Amount of valid data in array
Defined in
src/eosjs-serialize.ts:109
readPos
• readPos: number
= 0
Current position while reading (deserializing)
Defined in
src/eosjs-serialize.ts:115
textDecoder
• textDecoder: TextDecoder
Defined in
src/eosjs-serialize.ts:118
textEncoder
• textEncoder: TextEncoder
Defined in
src/eosjs-serialize.ts:117
Methods
asUint8Array
▸ asUint8Array(): Uint8Array
Return data with excess storage trimmed away
Returns
Uint8Array
Defined in
src/eosjs-serialize.ts:159
get
▸ get(): number
Get a single byte
Returns
number
Defined in
src/eosjs-serialize.ts:176
getAsset
▸ getAsset(): string
Get an asset
Returns
string
Defined in
src/eosjs-serialize.ts:480
getBytes
▸ getBytes(): Uint8Array
Get length-prefixed binary data
Returns
Uint8Array
Defined in
src/eosjs-serialize.ts:380
getFloat32
▸ getFloat32(): number
Get a float32
Returns
number
Defined in
src/eosjs-serialize.ts:302
getFloat64
▸ getFloat64(): number
Get a float64
Returns
number
Defined in
src/eosjs-serialize.ts:312
getName
▸ getName(): string
Get a name
Returns
string
Defined in
src/eosjs-serialize.ts:348
getPrivateKey
▸ getPrivateKey(): string
Get a private key
Returns
string
Defined in
src/eosjs-serialize.ts:520
getPublicKey
▸ getPublicKey(): string
Get a public key
Returns
string
Defined in
src/eosjs-serialize.ts:498
getSignature
▸ getSignature(): string
Get a signature
Returns
string
Defined in
src/eosjs-serialize.ts:534
getString
▸ getString(): string
Get a string
Returns
string
Defined in
src/eosjs-serialize.ts:390
getSymbol
▸ getSymbol(): Object
Get a symbol
Returns
Object
Name | Type |
---|---|
name | string |
precision | number |
Defined in
src/eosjs-serialize.ts:431
getSymbolCode
▸ getSymbolCode(): string
Get a symbol_code
. Unlike symbol
, symbol_code
doesn't include a precision.
Returns
string
Defined in
src/eosjs-serialize.ts:408
getUint16
▸ getUint16(): number
Get a uint16
Returns
number
Defined in
src/eosjs-serialize.ts:215
getUint32
▸ getUint32(): number
Get a uint32
Returns
number
Defined in
src/eosjs-serialize.ts:228
getUint64AsNumber
▸ getUint64AsNumber(): number
Get a uint64
as a number
. Caution: number
only has 53 bits of precision; some values will change.
numeric.binaryToDecimal(serialBuffer.getUint8Array(8))
recommended instead
Returns
number
Defined in
src/eosjs-serialize.ts:247
getUint8Array
▸ getUint8Array(len
): Uint8Array
Get len
bytes
Parameters
Name | Type |
---|---|
len | number |
Returns
Uint8Array
Defined in
src/eosjs-serialize.ts:192
getVarint32
▸ getVarint32(): number
Get a varint32
Returns
number
Defined in
src/eosjs-serialize.ts:287
getVaruint32
▸ getVaruint32(): number
Get a varuint32
Returns
number
Defined in
src/eosjs-serialize.ts:267
haveReadData
▸ haveReadData(): boolean
Is there data available to read?
Returns
boolean
Defined in
src/eosjs-serialize.ts:149
push
▸ push(...v
): void
Append bytes
Parameters
Name | Type |
---|---|
...v | number [] |
Returns
void
Defined in
src/eosjs-serialize.ts:171
pushArray
▸ pushArray(v
): void
Append bytes
Parameters
Name | Type |
---|---|
v | Uint8Array | number [] |
Returns
void
Defined in
src/eosjs-serialize.ts:164
pushAsset
▸ pushAsset(s
): void
Append an asset
Parameters
Name | Type |
---|---|
s | string |
Returns
void
Defined in
src/eosjs-serialize.ts:445
pushBytes
▸ pushBytes(v
): void
Append length-prefixed binary data
Parameters
Name | Type |
---|---|
v | Uint8Array | number [] |
Returns
void
Defined in
src/eosjs-serialize.ts:374
pushFloat32
▸ pushFloat32(v
): void
Append a float32
Parameters
Name | Type |
---|---|
v | number |
Returns
void
Defined in
src/eosjs-serialize.ts:297
pushFloat64
▸ pushFloat64(v
): void
Append a float64
Parameters
Name | Type |
---|---|
v | number |
Returns
void
Defined in
src/eosjs-serialize.ts:307
pushName
▸ pushName(s
): void
Append a name
Parameters
Name | Type |
---|---|
s | string |
Returns
void
Defined in
src/eosjs-serialize.ts:317
pushNumberAsUint64
▸ pushNumberAsUint64(v
): void
Append a uint64
. Caution: number
only has 53 bits of precision
Parameters
Name | Type |
---|---|
v | number |
Returns
void
Defined in
src/eosjs-serialize.ts:238
pushPrivateKey
▸ pushPrivateKey(s
): void
Append a private key
Parameters
Name | Type |
---|---|
s | string |
Returns
void
Defined in
src/eosjs-serialize.ts:513
pushPublicKey
▸ pushPublicKey(s
): void
Append a public key
Parameters
Name | Type |
---|---|
s | string |
Returns
void
Defined in
src/eosjs-serialize.ts:491
pushSignature
▸ pushSignature(s
): void
Append a signature
Parameters
Name | Type |
---|---|
s | string |
Returns
void
Defined in
src/eosjs-serialize.ts:527
pushString
▸ pushString(v
): void
Append a string
Parameters
Name | Type |
---|---|
v | string |
Returns
void
Defined in
src/eosjs-serialize.ts:385
pushSymbol
▸ pushSymbol(__namedParameters
): void
Append a symbol
Parameters
Name | Type |
---|---|
__namedParameters | Object |
__namedParameters.name | string |
__namedParameters.precision | number |
Returns
void
Defined in
src/eosjs-serialize.ts:421
pushSymbolCode
▸ pushSymbolCode(name
): void
Append a symbol_code
. Unlike symbol
, symbol_code
doesn't include a precision.
Parameters
Name | Type |
---|---|
name | string |
Returns
void
Defined in
src/eosjs-serialize.ts:395
pushUint16
▸ pushUint16(v
): void
Append a uint16
Parameters
Name | Type |
---|---|
v | number |
Returns
void
Defined in
src/eosjs-serialize.ts:210
pushUint32
▸ pushUint32(v
): void
Append a uint32
Parameters
Name | Type |
---|---|
v | number |
Returns
void
Defined in
src/eosjs-serialize.ts:223
pushUint8ArrayChecked
▸ pushUint8ArrayChecked(v
, len
): void
Append bytes in v
. Throws if len
doesn't match v.length
Parameters
Name | Type |
---|---|
v | Uint8Array |
len | number |
Returns
void
Defined in
src/eosjs-serialize.ts:184
pushVarint32
▸ pushVarint32(v
): void
Append a varint32
Parameters
Name | Type |
---|---|
v | number |
Returns
void
Defined in
src/eosjs-serialize.ts:282
pushVaruint32
▸ pushVaruint32(v
): void
Append a varuint32
Parameters
Name | Type |
---|---|
v | number |
Returns
void
Defined in
src/eosjs-serialize.ts:254
reserve
▸ reserve(size
): void
Resize array
if needed to have at least size
bytes free
Parameters
Name | Type |
---|---|
size | number |
Returns
void
Defined in
src/eosjs-serialize.ts:135
restartRead
▸ restartRead(): void
Restart reading from the beginning
Returns
void
Defined in
src/eosjs-serialize.ts:154
skip
▸ skip(len
): void
Skip len
bytes
Parameters
Name | Type |
---|---|
len | number |
Returns
void
Defined in
src/eosjs-serialize.ts:202